class Task23:
    def run(self, head):
        if head is None:
            return None

        quick = head.next
        slow = head

        while quick is not None and quick.next is not None and quick is not slow:
            quick = quick.next.next
            slow = slow.next

        if quick is None or quick.next is None:
            return None
        else:
            circle_length = 1
            node = slow.next
            while node is not slow:
                node = node.next
                circle_length += 1

            node1 = head
            node2 = head
            for _ in range(circle_length):
                node2 = node2.next
            while node1 is not node2:
                node1 = node1.next
                node2 = node2.next
            return node1
